package com.lmabbe.tenant.objects.converter;

import com.lmabbe.common.global.dict.BaseDictMapper;
import com.lmabbe.tenant.objects.entity.SysUser;
import com.lmabbe.tenant.objects.vo.SysUserVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author lmabbe
 */
@Mapper(uses = {BaseDictMapper.class}, imports = {BaseDictMapper.class}, componentModel = "spring")
public interface SysUserConverter {

    SysUserConverter CONVERTER = Mappers.getMapper(SysUserConverter.class);

    /**
     * 实体转VO
     *
     * @param user 用户
     * @return
     */
    @Mapping(target = "userSex", expression = "java(BaseDictMapper.conversion2BaseDict(user.getUserSex()))")
    SysUserVO entity2Vo(SysUser user);
}
